<section id="header">
	<div class="container">
		<div class="rows">
			<div class="col-md-9">
				<div class="row">
					<div class="col-md-12 col-sm-12">
						<div class="box-title-page">
							<h4>Products</h4>
						</div><br />
						<div class="row">
							<?php if(isset($res_products) && !empty($res_products)): foreach ($res_products as $product): ?>
							<div class="col-md-6 col-sm-12" style='margin-bottom:10px !important;'>
								<div class="box-article">
									<!-- Condition Image -->
									<?php if(empty($product->p_filename)) { ?>
									<img class="img-responsive" width='138' height='89' src="<?php echo img_theme('logo.png'); ?>" alt="Logo">
									<?php } else { ?>
									<img class="img-responsive" src="<?php echo site_url('home/appimage/products/'.$product->p_filename); ?>" alt="<?php echo $product->p_fileorig; ?>">
									<?php } ?>				
									<!-- End -->
									<div class="caption">
										<a href="<?php echo site_url('home/detail/'.slugify($product->p_name).'/'.$product->p_id); ?>"><h2 style='margin-bottom:1px !important;color:#b9b9b9;font-weight:bold'><?php echo $product->p_name; ?></h2></a>
										<h4 style='color:#e60000;margin-top:0px !important'><?php echo date("d F, Y", strtotime($product->p_created_date)); ?></h4>
									</div>
								</div>
							</div>
							<?php endforeach; else: ?>
								<div class="col-md-12 col-sm-12" style='margin-bottom:10px !important;'>
									<div class="text-center">
										<h2>Oops..! No Result for Product</h2>
									</div>
								</div>
							<?php endif; ?>
						</div>
					</div>
				</div>

				<div class="row">
					<div class="col-md-12 col-sm-12">
						<div class="box-title-page">
							<h4>Recipes</h4>
						</div><br />
						<div class="row">
							<?php if(isset($res_recipes) && !empty($res_recipes)): foreach ($res_recipes as $recipe): ?>
							<div class="col-md-6" style='margin-bottom:10px !important;'>
								<div class="box-article">
									<!-- Condition Image -->
									<?php if(empty($recipe->r_filename)) { ?>
									<img class="img-responsive" width='138' height='89' src="<?php echo img_theme('logo.png'); ?>" alt="Logo">
									<?php } else { ?>
									<img class="img-responsive" src="<?php echo site_url('home/appimage/recipes/'.$recipe->r_filename); ?>" alt="<?php echo $recipe->r_fileorig; ?>">
									<?php } ?>				
									<!-- End -->
									<div class="caption">
										<a href="<?php echo site_url('recipes/detail/'.slugify($recipe->r_name).'/'.$recipe->r_id); ?>"><h2 style='margin-bottom:1px !important;color:#b9b9b9;font-weight:bold'><?php echo $recipe->r_name; ?></h2></a>
										<h4 style='color:#e60000;margin-top:0px !important'><?php echo date("d F, Y", strtotime($recipe->r_created_date)); ?></h4>
									</div>
								</div>
							</div>
							<?php endforeach; else: ?>
								<div class="col-md-12 col-sm-12" style='margin-bottom:10px !important;'>
									<div class="text-center">
										<h2>Oops..! No Result for Recipes</h2>
									</div>
								</div>
							<?php endif; ?>
						</div>
					</div>
				</div>

				<div class="row">
					<div class="col-md-12 col-sm-12">
						<div class="box-title-page">
							<h4>Events</h4>
						</div><br />
						<div class="row">
							<?php if(isset($res_events) && !empty($res_events)): foreach ($res_events as $event): ?>
							<div class="col-md-6 col-sm-12" style='margin-bottom:10px !important;'>
								<div class="box-event-page">
									<img class="img-responsive" src="<?php echo site_url('home/appimage/events/'.$event->e_filename); ?>" alt="<?php echo $event->e_origname; ?>">
									<div class="caption">
										<?php 
											$find = array(" ",":");
											$name_event = str_replace($find,"-",$event->e_name);
										?>
										<a href="<?php echo site_url('home/detail-events/'.$event->e_id.'/'.$name_event)?>"><h2 style='margin-bottom:1px !important;color:#b9b9b9;font-weight:bold'><?php echo $event->e_name; ?></h2></a>
										<h4 style='color:#e60000;margin-top:0px !important'><?php echo date("d F, Y", strtotime($event->e_date)); ?></h4>
									</div>
								</div>
							</div>
							<?php endforeach; else: ?>
								<div class="col-md-12 col-sm-12" style='margin-bottom:10px !important;'>
									<div class="text-center">
										<h2>Oops..! No Result for Event</h2>
									</div>
								</div>
							<?php endif; ?>
						</div>
					</div>
				</div>

				<div class="row">
					<div class="col-md-12 col-sm-12">
						<div class="box-title-page">
							<h4>Articles</h4>
						</div><br />
						<div class="row">
							<?php if(isset($res_articles) && !empty($res_articles)): foreach ($res_articles as $article): ?>
							<div class="col-md-6" style='margin-bottom:10px !important;'>
								<div class="box-article">
									<img class="img-responsive" src="<?php echo site_url('home/appimage/articles/'.$article->a_filename); ?>" alt="<?php echo $article->a_origname; ?>">
									<div class="caption">
										<a href="<?php echo site_url('home/detail/'.slugify($article->a_title).'/'.$article->a_id); ?>"><h2 style='margin-bottom:1px !important;color:#b9b9b9;font-weight:bold'><?php echo $article->a_title; ?></h2></a>
										<h4 style='color:#e60000;margin-top:0px !important'><?php echo date("d F, Y", strtotime($article->a_created_date)); ?></h4>
									</div>
								</div>
							</div>
							<?php endforeach; else: ?>
								<div class="col-md-12 col-sm-12" style='margin-bottom:10px !important;'>
									<div class="text-center">
										<h2>Oops..! No Result for Article</h2>
									</div>
								</div>
							<?php endif; ?>
						</div>
					</div>
				</div>
			</div>
			<div class="col-md-3">
				<div class="bs-example">
				    <div class="list-group">
				        <a href="#" class="list-group-item active">
				            <span class="glyphicon glyphicon-file"></span> Recent Article
				        </a>
				        <?php if(isset($recent_articles)): foreach ($recent_articles as $articles): ?>
							<a href="<?php echo site_url('articles/detail/'.$articles->a_title.'/'.$articles->a_id); ?>" class="list-group-item">
								<i class="fa fa-gift"></i> <?php echo $articles->a_title; ?>
							</a>	
						<?php endforeach; endif; ?>
				    </div>
				</div>
				<div class="bs-example">
				    <div class="list-group">
				        <a href="#" class="list-group-item active">
				            <span class="glyphicon glyphicon-file"></span> Recent Recipes
				        </a>
				        <?php if(isset($recent_products)): foreach ($recent_products as $products): ?>
							<a href="<?php echo site_url('products/detail/'.slugify($products->p_name).'/'.$products->p_id); ?>" class="list-group-item">
								<i class="fa fa-gift"></i> <?php echo $products->p_name; ?>
							</a>	
						<?php endforeach; endif; ?>
				    </div>
				</div>
				<div style='margin-top:10px;margin-bottom:10px;'>
					<?php
						if(isset($widget_home)): foreach ($widget_home as $widget): 
							if ($widget->widget_place == 1)	echo $widget->widget_source;
						endforeach; endif; 
					?>
				</div>
			</div>
		</div>
	</div>
</section>